package com.xf.lastmall.moudle.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@NoArgsConstructor
@IdClass(OrderCheckAccountPK.class)
@Entity(name = "tb_order_check_account")
public class OrderCheckAccount implements Serializable {


    @Id
    @Column(name = "order_no_", length = 64, columnDefinition = "varchar(64) COMMENT '一点万象订单号'")
    private String orderNo;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "trade_time_", columnDefinition = "DATETIME COMMENT '交易时间,付款或者退款时间'")
    private Date tradeTime;

    @Id
    @Column(name = "refund_no_", length = 64, columnDefinition = "varchar(64) COMMENT '微信退款单号'")
    private String refundNo;

    @Column(name = "mall_code_", nullable = false, columnDefinition = "varchar(30) COMMENT '商场编码'")
    private String mallCode;

    @Column(name = "pay_way", columnDefinition = "varchar(4) COMMENT '支付方式'")
    private Integer payWay;

    @Column(name = "trade_status_", length = 20, columnDefinition = "varchar(20) COMMENT '交易状态：付款，退款'")
    private String tradeStatus;

    @Column(name = "trade_no_", length = 64, columnDefinition = "varchar(64) COMMENT '微信支付交易号'")
    private String tradeNo;

    @Column(name = "pay_money_", precision = 12, scale = 2, columnDefinition = "decimal(12,2) COMMENT '支付金额'")
    private BigDecimal payMoney;

    @Column(name = "refund_trade_no_", length = 64, columnDefinition = "varchar(64) COMMENT '微信支付交易号'")
    private String refundTradeNo;

    @Column(name = "refund_money_", precision = 12, scale = 2, columnDefinition = "decimal(12,2) COMMENT '退款金额'")
    private BigDecimal refundMoney;

    @Column(name = "mobile_", columnDefinition = "varchar(20) COMMENT '手机号'")
    private String mobile;

    @Column(name = "commodity_name_", columnDefinition = "varchar(60) comment '商品名称'")
    private String commodityName;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "f_create_time", insertable = false, updatable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
    private Date createTime;

    @Column(name = "check_result_", columnDefinition = "varchar(4) COMMENT '1正常2一点万象单边3支付渠道单边4金额不匹配'")
    private Integer checkResult;

    @Column(name = "return_id_", columnDefinition = "varchar(64) COMMENT '退货编号'")
    private String returnId;

    public OrderCheckAccount(String orderNo, Date tradeTime) {
        this.orderNo = orderNo;
        this.tradeTime = tradeTime;
    }
}
